#include "DeclareFile.h"
#include "tools.h"

void Modify() {
	BeginBatchDraw();
	cleardevice();
	putimage(0, 0, &TitleImg); // 背景图片
	setbkmode(TRANSPARENT);

	int graph_w = getwidth();
	int graph_h = getheight();
	COLORREF color1 = WHITE;
	COLORREF color2 = RGB(200, 200, 200);

	settextstyle(16, 0, "宋体");
	settextcolor(BLACK);

	char str1[] = "音乐设置";
	int tw = textwidth(str1); // 文本宽度
	int th = textheight(str1); // 文本高度
	int tx = (graph_w - tw) / 2; // 文本坐标x
	int ty = 50; // 文本坐标y
	outtextxy(tx, ty, str1);

	// 显示音乐大小
	char str4[5] = "";
	sprintf_s(str4, "%d", MusicSizeNumber);
	int musicX = graph_w / 2 - textwidth(str4) / 2;
	int musicY = graph_h / 4 - textheight(str4) / 2 - 20;
	outtextxy(musicX, musicY, str4);

	setlinecolor(RGB(234, 149, 24));
	settextcolor(RGB(234, 149, 24));

	// 音量减小
	char str2[] = "一";
	int bx1 = graph_w / 4;
	int by1 = graph_h / 4;
	if (button(bx1, by1, str2, 10, color1, color2)) {
		if (MusicSizeNumber > 0) {
			MusicSizeNumber -= 5;
		}
	}

	// 音量增大
	char str3[] = "十";
	int bx2 = graph_w * 3 / 4;
	int by2 = graph_h / 4;
	if (button(bx2, by2, str3, 10, color1, color2)) {
		if (MusicSizeNumber < 100) {
			MusicSizeNumber += 5;
		}
	}

	// 显示音量条
	int lineX = graph_w / 2 - 150;
	int lineY = graph_h / 4 - 5;
	drawBloodBar(lineX, lineY, 300, 10, 3, BLUE, DARKGRAY, RGB(234, 149, 24), MusicSizeNumber / 100.0 - 0.002);

	// 显示返回菜单
	/*char str5[] = "返回菜单";
	int bx3 = graph_w / 2;
	int by3 = graph_h * 3 / 4;
	if (MENU_SET && button(bx3, by3, str5, 20, color1, color2)) {
		flag = 1;
		return;
	}*/

	// 显示继续游戏
	char str6[] = "返回";
	int bx4 = graph_w / 2;
	int by4 = graph_h * 3 / 4;
	if (GAME_PAUSE_SET && button(bx4, by4, str6, 20, color1, color2)) {
		flag = 3;
		setbkcolor(BLACK);
		cleardevice();
		return;
	}
	else if (!GAME_PAUSE_SET && button(bx4, by4, str6, 20, color1, color2)) {
		flag = 1;
		setbkcolor(BLACK);
		cleardevice();
		return;
	}

	//msg.message = 0;
	EndBatchDraw();
}